/**
 *  @type Logic Component
 *  @role 用于页面title展示
 *  @createDate Mr.Liu on 2017.06.05.15:22
 */

import React from "react";

import {Table,Tooltip} from 'antd';

export default class A extends React.Component {
    constructor(props) {
        super(props);
        this.state = {

        };

        this.operation = this.operation.bind(this);
    }

    componentWillMount(){}

    componentDidMount(){}

    operation(r,t,i){
        this.props.openInoutDetailModal(r,t,i)
    }

     columns = [{
        title: '发货时间',
        dataIndex: 'sendDate',
        key: 'sendDate',
    }, {
        title: '数量',
        dataIndex: 'quantity',
        key: 'quantity',
    }, {
        title: '剩余数量',
        dataIndex: 'remainingQuantity',
        key: 'remainingQuantity',
    },{
         title: '本次发货数量',
         dataIndex: 'sendQuantity',
         key: 'sendQuantity',
     },{
         title: '物流信息',
         dataIndex: 'logisticsMsg',
         key: 'logisticsMsg',
         width:300,
         render:(t,r,i)=>{
             return <Tooltip title={t ? t.length >= 26 ? t :null : null}>
                 <span className="order_inoutDetailTable_logisticsMsg">  {t} </span>
             </Tooltip>
         }
     },{
         title: "状态",
         dataIndex: 'receiveStatus',
         key: 'receiveStatus',
     },{
         title: '操作',
         dataIndex: 'operation',
         key: 'operation',
         render:(t,r,i)=>{
            return <a style={{color:"#36b3b3"}}  onClick={()=>{this.operation(t,r,i)}}>
                查看
            </a>
         }
     },
     ];

    columns_1 = [{
            title: '发货时间',
            dataIndex: 'sendDate',
            key: 'sendDate',
        }, {
            title: '数量',
            dataIndex: 'quantity',
            key: 'quantity',
        }, {
            title: '剩余数量',
            dataIndex: 'remainingQuantity',
            key: 'remainingQuantity',
        },{
            title: '本次收货数量',
            dataIndex: 'sendQuantity',
            key: 'sendQuantity',
        },{
            title: '物流信息',
            dataIndex: 'logisticsMsg',
            key: 'logisticsMsg',
            width:300,
            render:(t,r,i)=>{
                return <Tooltip title={t ? t.length >= 26 ? t :null : null}>
                    <span className="order_inoutDetailTable_logisticsMsg">  {t} </span>
                </Tooltip>
            }
        },{
            title: '操作',
            dataIndex: 'operation',
            key: 'operation',
            render:(t,r,i)=>{
                return  r.receiveStatus == "已收货" ? <a style={{color:"#36b3b3"}}  onClick={()=>{this.operation(t,r,i)}}> 查看 </a> : <button className="order_inout_record_btn" onClick={()=>{this.operation(t,r,i)}}>
                    确认收货
                </button>
            }
        },
    ];


    render() {
        const {data,orderStatus} = this.props;
        return  (
           <Table
               className="order_table order_inoutDetailTable"
               columns={orderStatus == "1" ? this.columns : this.columns_1}
               dataSource={data}
               pagination={false}
               // bordered
           >

           </Table>
        )
    }
}